package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(30);not null;comment:'账号'"`
	Password string `gorm:"type:char(32);not null;comment:'密码'"`
}

func (u *User) CreateUser() error {
	return DB.Create(&u).Error
}

func (u *User) GetUserBy() error {
	return DB.Where("userName = ?", u.Username).Limit(1).Find(&u).Error
}
